﻿#region Using directives

using System;
using System.Collections.Generic;
using System.Text;

using Weazel.Gezel.Model.Errors;

#endregion

namespace Weazel.Gezel.Model
{
  public partial class SignalFlowGraph : IVerifiable
  {
    /// <summary>
    /// Verify the SignalFlowGraph.
    /// </summary>
    /// <param name="errors">the list of accumulated errors</param>
    /// <param name="arguments">optional custom arguments</param>
		public void Verify(ref List<VerificationError> errors, ref List<VerificationWarning> warnings, params object[] arguments)
    {
			// check that the name of this sfg is ok
			Identifier.Verify(ref errors, ref warnings, localName, StartPosition);

			// verify local signal
			if (signal != null)
				signal.Verify(ref errors, ref warnings);

			// verify local register
			if (register != null)
				register.Verify(ref errors, ref warnings);

      // verify each expression and pass
      // a reference to the enclosing datapath
      // as the scope for resolving identifiers
      // to the referenced entities and the 
      // enclosing signalflowgraph
      foreach (Expression expr in expressions)
        expr.Verify(ref errors, ref warnings, parent, this);
    }
  }
}
